% removeVertex removes a vertex from a graph
function newG = removeVertex(vertex,oldG,varargin)

[xmax ymax]=size(oldG);
newGp = zeros(xmax-1,ymax);
newG = zeros(xmax-1,ymax-1);
n = 1;
% trim in one direction
for x=1:xmax
    if (x ~= vertex),
        for y=1:ymax
            newGp(n,y) = oldG(x,y); 
        end;
        n = n + 1;
    end;
end;
% trim in the other direction
for x=1:(xmax-1)
    n = 1;
    for y = 1:ymax
        if (y ~= vertex)
            newG(x,n) = newGp(x,y); 
            n = n + 1;        
        end;
    end;
end;

